<?php
//
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
$this->model('member')->checklogin();
$return['member']=model('core/member')->detail($_SESSION['uid'],array('credit1','credit2','mobile','avatar','nickname'));
set_html('title','我的运势');
if($_RQ['op']=='main'){
	$return['sale_luck']=$this->model('activity/sales')->getluck(true);
	$return['closedsales']=1;
	$current_plugin=$_SESSION['current_plugin']?:'jy_weishop';
	if($return['sale_luck']){
			$sharelink=$current_plugin.'/index//fromuser='.$_SESSION['uid'].'&luckkey='.$return['sale_luck']['luckkey'];
			if($sale_luck['share_title']){
				$sale_luck['share_title']=str_replace('[lucktitle]',$return['sale_luck']['title'],$sale_luck['share_title']);
			}
			if($sale_luck['share_desc']){
				$sale_luck['share_desc']=str_replace('[lucktitle]',$return['sale_luck']['title'],$sale_luck['share_desc']);
			}
			$return['sharedata']=array(
				'title'=>$sale_luck['share_title']?$sale_luck['share_title']:'我今日运势《'.$return['sale_luck']['title'].'》，快来借势吧,好运势享大折扣！',
				'desc'=>$sale_luck['share_desc']?$sale_luck['share_desc']:'拥有好运势，不仅仅拥有好心情，更能享受好的购物折扣哦！',
				'link'=>custom_url($sharelink,true),
				'imgUrl'=>$sale_luck['share_image']?tomedia($sale_luck['share_image']):tomedia('../addons/jy_weishop/resource/images/sales/luck_share_image.jpg')
			);
	}else{
			$sharelink=$current_plugin.'/index//fromuser='.$_SESSION['uid'];
			$return['sharedata']=array(
				'title'=>$setting['share_title']?$setting['share_title']:'首页-在线商城',
				'desc'=>$setting['share_desc']?$setting['share_desc']:'在线商城，一个属于自己的个人商城！',
				'link'=>custom_url($sharelink,true),
				'imgUrl'=>ATTACHMENT_URL.$setting['share_image']
			);
	}
	//小程序二维码：
	$url=$current_plugin.'/index/index?luckkey='.$return['sale_luck']['luckkey'].'&fromuser='.$_SESSION['uid'];
	$pid='mid'.$_SESSION['uid'].'luck'.$return['sale_luck']['luckkey'];
	$return['sale_luck']['appcode'] = $this->model('model')->get_wxappewm($url,$pid);
	exi($return);
}
?>